package com.example.service;

import com.example.config.datasource.DynamicDataSourceSwitcher;
import com.example.config.datasource.MyDataSource;
import com.example.entity.People;
import com.example.mapper.PeopleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class PeopleService {
    @Autowired
    private PeopleMapper peopleMapper;

    @MyDataSource(DynamicDataSourceSwitcher.Mater)
    public List<People> findAll() {
        return peopleMapper.findAllPeople();
    }


    public People findById(Integer id) {
        return peopleMapper.findById(id);
    }

    public int add(People people) {
        return peopleMapper.add(people);
    }
}



